﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Exhibition.Common.Helper;
using Exhibition.Dao.ViewModel;
using Exhibition.Service;

namespace Exhibition.Manage
{
    public partial class BadgesDetail : BaseAdminPage
    {
     public  BadgesModel model = new BadgesModel();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                GetBadges();
            }
        }
        private void GetBadges()
        {

            model = CenterService.badgesService.GetOneById(reqID);
            if (model != null)
            {

                ////
                //txtCompName.Value = model.CompName.ToString();

                ////
                //txtRealName.Value = model.RealName.ToString();

                ////
                //txtPosition.Value = model.Position.ToString();

                //
                imglogo.Src = model.UserLogo.ToString();

                ////
                //txtCreateTime.Value = model.CreateTime.ToString();

                ////
                //txtCreateUserId.Value = model.CreateUserId.ToString();

                ////
                //txtCreateUserName.Value = model.CreateUserName.ToString();

                ////
                //txtSiteId.Value = model.SiteId.ToString();

            }

        }
        /// <summary>
        /// 保存一条数据
        /// <summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {

            model = string.IsNullOrEmpty(hfId.Value) || hfId.Value == "0" ? new BadgesModel() : CenterService.badgesService.GetOneById(Convert.ToInt32(hfId.Value));
            //
            //model.CompName = txtCompName.Value;

            ////
            //model.RealName = txtRealName.Value;

            ////
            //model.Position = txtPosition.Value;

            //
            //model.UserLogo = txtUserLogo.Value;

            //
            model.CreateTime =DateTime.Now;

            //
            model.CreateUserId = AdminUser.Id;

            //
            model.CreateUserName = AdminUser.UserName;

            //
            model.SiteId = CurrentSite.Id;

            if (CenterService.badgesService.Save(model) > 0)
            {

                JsHelper.Unblock(this, CommFunMsg.GetMessage("a0001", Lan.zh));
                return;
            }
            else
            {
                JsHelper.Alert(this, CommFunMsg.GetMessage("e0001", Lan.zh));
                return;
            }


        }
    }
}